package gtug.duesseldorf.client.ui;

import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.TextBox;

public class LogBox extends Composite {

	private final TextBox m_tfBox = new TextBox();

	public LogBox() {
		initWidget(m_tfBox);
	}

	public void append(String msg) {
		if (msg == null) {
			return;
		}

		String txt = m_tfBox.getText();
		if (txt == null) {
			txt = "";
		}
		txt += msg + "\n";

		m_tfBox.setText(txt);
		m_tfBox.setCursorPos(txt.length() - 1);
	}

	public void clear() {
		m_tfBox.setText("");
	}

}
